{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 44 机器学习"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.【选择】请选择合适的代码补充到横线处，使对“quantity”列进行降维处理。（ ）  \n",
    "`import pandas as pd\n",
    "import numpy as np\n",
    "import os\n",
    "data = pd.read_csv('data.csv', header=0\n",
    "sort_data = ____(data[['quantity']])`\n",
    "\n",
    "A.pd.ravel  \n",
    "B.np.ravel  \n",
    "C.os.ravel"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：B"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.【判断】可以用模块sklearn.model_selection中的函数train_test_split()拆分训练集和测试集。（ ）  \n",
    "\n",
    "A.√  \n",
    "B.×"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：A"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.【填空】计算模型的准确率的方法是：用模块sklearn.metrics中的函数（ ）。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：accuracy_score()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.【填空】用KNN进行算法选择和设置超级参数，需要从sklearn.neighbors中导入（）分类器。  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：KNeighborsClassifier"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.【编程】利用seaborn的内置数据iris，根据鸢尾花(iris)的花瓣长度(petal_length)、花瓣宽度(petal_width)、花萼长度(sepal_length)、花萼宽度(sepal_width)数据，通过机器学习建立数据模型，判断出鸢尾花的种类。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：参见本章内容"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
